<template>
  <el-dialog title="监控" :visible="show" top="20vh" width="50%" :before-close="close">
    <span>选择监控：</span>
    <el-select v-model="sel" placeholder="请选择" @change="onChangeSel">
      <el-option v-for="item in options" :key="item.indexCode" :label="item.cameraName" :value="item.indexCode">
      </el-option>
    </el-select>
    <FlvPlayer style="margin-top: 10px;" :code="sel" :params="params"></FlvPlayer>
  </el-dialog>
</template>
<script>
export default {
  props: {
    options: {
      type: [Array, null],
      default: null
    }
  },
  data() {
    return {
      show: true,
      sel: null,
      params: {brand: 'artemis'}
    };
  },
  mounted() {
    this.$nextTick(_=>{
      this.sel = this.options && this.options.length && this.options[0].indexCode
    })
  },
  methods: {
    onChangeSel(e) {
      this.$emit('change', e)
    },
    close() {
      this.$emit('close')
    },
    confirm() {},
  },
};
</script>
